package httputils

import (
	"encoding/json"
	"net/http"
)

type respJSON struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

func ReadJSON(r *http.Request, obj interface{}) error {
	if err := json.NewDecoder(r.Body).Decode(obj); err != nil {
		return err
	}
	defer r.Body.Close()
	return nil
}
